#!/usr/bin/env node

const rd = require('rd');

const fs = require("fs");
const process = require('child_process');

fs.readdirSync('F:\\dev\\gaiay\\all');
// 同步列出目录下的所有文件
let files = rd.readSync('F:\\dev\\gaiay\\all');
for (let f of files) {
    let stat = fs.statSync(f);
    if (f.match(/resources\\dev/) && stat.isFile()) {
        let config = fs.readFileSync(f, "utf-8");
        config =config /* config.replace(/192.168.0.227:16234/g, '192.168.0.105:16234')
            .replace(/bang_gaiay_net_cn/g, 'dev_bang_gaiay_cn')
            .replace(/elastic_job_event/g, 'dev_elastic_job_event')
            .replace(/games_gaiay_net_cn/g, 'dev_games_gaiay_cn')
            .replace(/ma_gaiay_net_cn/g, 'dev_ma_gaiay_cn')
            .replace(/mo_gaiay_net_cn/g, 'dev_mo_gaiay_cn')
            .replace(/tc_gaiay_net_cn/g, 'dev_tc_gaiay_cn')
            .replace(/wallet_gaiay_net_cn/g, 'dev_wallet_gaiay_cn')
            .replace(/zm_gaiay_net_cn/g, 'dev_zm_gaiay_cn')
            .replace(/zx_gaiay_net_cn/g, 'dev_zx_gaiay_cn')
            .replace(/192.168.0.227/g, '192.168.0.105')
            .replace(/192.168.0.236/g, '192.168.0.105')
            .replace(/zm.gaiay.net.cn/g, 'dev-m.gaiay.net')
            .replace(/mo.gaiay.net.cn/g, 'dev-mc.gaiay.net')
            .replace(/wallet.gaiay.net.cn/g, 'dev-wallet.gaiay.net')


            .replace(/wjdbc.password=1234/g, 'wjdbc.password=123456')
            .replace(/wjdbc.username=root/g, 'wjdbc.username=test')

            .replace(/jdbc.username=root/g, 'jdbc.username=test')
            .replace(/jdbc.password=1234/g, 'jdbc.password=123456')


            .replace(/redisPwd=123456/g, 'redisPwd=654321')*/
            .replace(/56b6b9150d5afcb40-8000/g, '56b6b9150d5afcb40-8001')



        ;
        fs.writeFileSync(f, config, 'utf-8')
        // console.log(config)
    }
}